class ManageController < ApplicationController
	layout 'manage'
  before_action :authenticate_user!

  skip_before_filter :verify_authenticity_token , only: [:update_profile]

  def index
  end

  def credit_records
  	@credit_records = current_user.credit_records.order(created_at: :desc).page params[:page]
  end

  def profile
  	
  end

  def update_profile
    
    respond_to do |format|
      if current_user.can_certify? && current_user.update( user_params )


        current_user.certify!
        format.json  { render json: current_user, status: :ok }
        format.html { render :profile }
      else
        format.json  { head :bad_request }
      end
    end
  end

  def modify
    
  end

  def certify

  end
  
  def show
    
  end


  
  # Use callbacks to share common setup or constraints between actions.
  def user_params
    params.require(:user).permit( :realname, :citizen_id, :company_name, :car_number,
      :picture_citizen_card_front,:picture_citizen_card_back,:picture_business_license)
  end
end
